import numpy as np
import trimesh

def evaluate_mesh_quality(mesh: trimesh.Trimesh):
    """网格质量评估"""
    qualities = trimesh.triangles.quality(mesh.triangles)
    edge_lengths = mesh.edges_unique_length
    print("\n网格质量报告:")
    print(f"- 三角形数量: {len(mesh.faces)}")
    print(f"- 顶点数量: {len(mesh.vertices)}")
    print(f"- 平均边长: {np.mean(edge_lengths):.4f} ± {np.std(edge_lengths):.4f} m")
    print(f"- 三角形质量: {np.mean(qualities):.2%} (0-100%, 越高越好)")
    print(f"- 最小质量三角形: {np.min(qualities):.2%}")